package 数组;

import 类和对象.Zuoye03211;

import java.util.Scanner;

public class Zuoye032311 {
    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        Zuoye03231 a=new Zuoye03231();
        int choice=0;
        while (true){
            System.out.println("1.添加会员卡，2.给用户涨分，3.兑换礼品，4.退出");
            choice=scan.nextInt();
            if (choice==1){
                System.out.println("请输入您的姓名：");
                String sname=scan.next();
                System.out.println("请输入您的手机号码：");
                String snumber=scan.next();
                a.check(snumber);
                boolean exists=a.check(snumber);
                if (exists){
                    System.out.println("输入的手机号已被用过，请重新输入！");
                    continue;
                }
                System.out.println("请输入您的出生日期：");
                String sbirthday=scan.next();
                a.yonghu(sname,snumber);
            }
            else if (choice==2){
                System.out.print("请输入会员的手机号码：");
                String number1=scan.next();
                System.out.println("请输入要添加多少分：");
                int fenshu1=scan.nextInt();
                a.inc(number1,fenshu1);
                boolean exists=a.inc(number1,fenshu1);
                if(exists){
                    System.out.println("添加成功！");
                }else{
                    System.out.println("该账号不存在！");
                }
            }else if (choice==3){
                System.out.println("1：100分兑换餐巾纸一包；\n" + "2：400分兑换剃须刀一把；\n" + "3：1000分兑换炒锅一个；");
                System.out.println("请输入用户手机号码和需要兑换的奖品：");
                String number2=scan.next();
                int lipin=scan.nextInt();
                a.duihuan(number2,lipin);
                boolean exists=a.duihuan(number2,lipin);
                if (exists){
                    System.out.println("兑换成功！");
                }else {
                    System.out.println("兑换失败！");
                }
            }else if (choice==4){
                break;
            }
        }
    }
}
